// 打开弹窗
function open_sub_window() {
  document.querySelector('.popup').classList.add('show');
}

// 关闭弹窗
function close_sub_window() {
  document.querySelector('.popup').classList.remove('show');
}

function color_but(){
  var colorBtn = document.getElementById("color_but");
  var music_list = document.getElementById('music_list');
  var sidenav = document.getElementById('sidenav');
  if(colorBtn.innerHTML=="神秘按钮"){
    colorBtn.innerHTML="取消";
    alert("写着玩的Ciallo～(∠・ω< )⌒☆");
    music_list.classList.add('blinking-text');
    sidenav.classList.add('blinking-text');
  }
  else if(colorBtn.innerHTML=="取消"){
    colorBtn.innerHTML="神秘按钮";
    music_list.classList.remove('blinking-text');
    sidenav.classList.remove('blinking-text');
  }
}

document.addEventListener('DOMContentLoaded', function() {
  //背景模糊？
    const blurCheckbox = document.querySelector('.switch input[type="checkbox"]');
    if (blurCheckbox) {
        blurCheckbox.addEventListener('change', function() {
          console.log(1111);
            if (this.checked) {
                document.getElementById('bg').style.filter = 'grayscale(0.4) brightness(0.6) blur(80px)';
            } else {
                document.getElementById('bg').style.filter = 'none';
            }
        });
    }

    //背景模糊2
    const blurCheckbox2 = document.getElementById("blur_lineedit");
    if (blurCheckbox2) {

        blurCheckbox2.addEventListener('input', function() {
            var num = blurCheckbox2.value;
            console.log(num);
            document.getElementById('bg').style.filter = ` blur(${80 * num}px)`;
        });
    }

    //字体颜色
    const colorCheckbox = document.getElementById("color_select");
    if (colorCheckbox) {

        colorCheckbox.addEventListener('input', function() {
            var color = colorCheckbox.value;
            console.log(color);
            document.getElementById('music_list').style.color=color;
            document.getElementById('sidenav').style.color=color;
        });
    }
});

